<template lang="pug">
  .page
    .pl-20.pr-20.bg-white
      Table.hasTitle-table.beautiful-table(width="100%" stripe :loading="loading" :columns="thead" :data="listData")
        div(slot="header")
          .pull-left.table-title-lefttxt
            span.leftText
              | 企业总数:
              span.text-info.pl-5.pr-5.font-weight {{totalcount}}
              | 家
        .clearfix.pl-20.pr-20(slot="footer")
          Page(:total="totalcount" :current="pageIndex" :page-size="pageSize" prev-text="上一页" next-text="下一页" @on-change="pageChange" show-total)
</template>

<script>
import fxzpApi from '@/api/fx-zp.api.js'
import Mixin from './mixin.js'

export default {
  name: 'enterprise',
  data () {
    return {
      // 企业列表
      listData: [],
      // 总条目
      totalcount: 0,
      // 翻页索引
      pageIndex: 1,
      // 每页的数目
      pageSize: 10,
      loading: false
    }
  },
  mixins: [Mixin],
  created () {
    this.getListData()
  },
  methods: {
    // 获取企业列表
    getListData () {
      this.loading = true
      fxzpApi.GetEnterPriseList({
        txtSearch: '',
        PageSize  : this.pageSize,
        PageIndex : this.pageIndex
      }).then(res => {
        this.loading = false
        if (res.data.success) {
          this.listData = res.data.data
          this.totalcount = res.data.totalRows
        } else {
          this.$Message.error({
            content: res.data.message,
            duration: 10,
            closable: true
          })
        }
      })
    },
    // 翻页
    pageChange (index) {
      this.pageIndex = index
      this.getListData()
    }
  }
}
</script>

<style lang="less" scoped>
</style>
